package gussfist.game;

import java.util.zip.CheckedOutputStream;

public class GussGame {
    public static Computer computer = new Computer();
    public static Player player = new Player();

    public static void main(String[] args) {
        GussGame gussGame = new GussGame();
        gussGame.compare();
    }

    public void compare() {
        int com = 0, pla = 0;
        for (int i = 0; i < 10; i++) {
            player.generateNumbers();
            int b = player.getNumber();//玩家出拳
            computer.generateNumbers();
            int a = computer.getNumber();//电脑出拳
            if (a == 1 && b == 2 || a == 2 && b == 3 || a == 3 && b == 1) {
                com = computer.getScore() + 3;
                computer.setScore(com);
                System.out.println("电脑赢了,电脑现在" + computer.getScore() + "分");
            } else if (a == b) {
                pla = player.getScore() + 1;
                player.setScore(pla);
                System.out.println("平局,现在玩家" + player.getScore() + "分");
            } else {
                pla = player.getScore() + 3;
                player.setScore(pla);
                System.out.println("玩家赢了,玩家现在" + player.getScore() + "分");
            }
            if (pla >=15) {
                System.out.println("玩家获胜");
                break;
            }
            if (com >=15) {
                System.out.println("电脑获胜");
                break;
            }
        }
    }
}
